home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 076-100 / 092 / bawk / readme < prev    next >
Text File  |  1995-03-13  |  3KB  |  81 lines

  1. Changes as of 19-JUL-1987
  2.  
  3. I got this code from Fish disk number 65. Although the program is well
  4. written it did not run on the Amiga. I set out to get it running and have
  5. by now, as usual, spent far to much time on it. I release this update in the
  6. hope that someone else will do some work on it.
  7.  
  8. I going to say a lot of negative things about Bawk here. This should not
  9. taken as critisism against the original author. As I said above the program
  10. was well written and it was fun to work with it. The characteristics of
  11. the original program is 'almost correct, easy to understand, but slow'.
  12. I much prefer to work with such code as compared to 'fast but buggy' code.
  13.  
  14. Although you may not believe it at first, there is really a lot of
  15. functionality in this program. However; Bawk is not awk. There is a lot of
  16. functionality lacking, and Bawk is also slower. You can be the one to
  17. change all that... 8-)
  18.  
  19. Here are the some differences between awk and Bawk.
  20.  
  21. Regular expressions in Bawk are delimited by '@', not '/':
  22.     @[Ff]oo@
  23.  
  24. The function 'print' is not implemented. You have to get by with 'printf'.
  25. The reason that print is not yet implemented is that automatic
  26. conversion between string values and other (e.g. numerical) values is not
  27. yet implemented.
  28.  
  29. Assignment between arrays is not automatic. You have to use strcpy:
  30.     Awk:    $1 = "foo"
  31.     Bawk:    strcpy($1,"foo")
  32.  
  33. Redirection (printf "%s", $0 >file) is not implemented.
  34.  
  35. To match a field in awk you can say
  36.     $1 ~ /[Ff]oo/
  37. in Bawk you say
  38.     match($1,@[Ff]oo@)
  39.  
  40. Arrays in Bawk are not associative. It would probably be a good idea to
  41. remove the declarations from Bawk and to make type handling and array
  42. handling more like awk.
  43.  
  44.  
  45. Some minor changes:
  46. Bawk can now take a command line pattern.
  47. Here are three ways of invoking awk:
  48.  
  49. $ bawk @[Ff]oo@ file
  50. $ echo >xxx @[Ff]oo@
  51. $ bawk -f xxx file
  52. $ bawk - file
  53. @[Ff]oo@
  54.  
  55. The braindamaged parsing of command line arguments on the Amiga forced me
  56. to define an alternative string delimiter. Strings can now be delimited
  57. by '`' (`a string`) as well as '"' ("a string"). This behaviour is
  58. optional. If you do not like it then undefine QUOTE_STRING_HACK in bawk.h.
  59.  
  60. I have used the Lattice C compiler. Conversion to manx with 32 bit ints
  61. should be easy. The code assumes that sizeof(int) == sizeof(char *).
  62.  
  63. I used Fred Fish's dbug package to develop the current version. The name
  64. dbug is a bit of a misnomer, 'trace' is a more appropriate name. dbug
  65. implements tracing in an orderly manner. Very useful. The package is
  66. available on Fish disk 41. An older version is on disk 2.
  67.  
  68. The trace code is conditionally compiled in depending on the definition
  69.     DBUG_OFF
  70. To compile with tracing, comment out the definition of DBUG_OFF in bawk.h.
  71. You can then invoke tracing and dbug printing with
  72.     bawk -\#t:d action file
  73. Select printing only with
  74.     bawk -\#d action file
  75. Note that bawk will run slower and be a bit larger if you compile with
  76. tracing enabled.
  77.  
  78.             Johan Widen
  79.             USENET: jw@sics.se
  80.